package phase01.module2.code.question3;

public class SIM {
    private SIMType type = SIMType.NORMAL;
    private String number;
    private String username;
    private String password;
    private double balance = 100.0;
    private int callTime = 0;
    private double dataRemain;
    private Invoice invoice;

    {
        invoice = new Invoice();
    }

    public SIM() {
    }

    public SIM(SIMType type, String number, String username, String password) {
        this.type = type;
        this.number = number;
        this.username = username;
        this.password = password;
    }

    public void show() {
        System.out.println("=============================================================");
        System.out.println("卡号：" + number);
        System.out.println("用户名：" + username);
        System.out.println("当前余额：" + balance);
        System.out.println("本月账单：");
        invoice.show();
    }

    public SIMType getType() {
        return type;
    }

    public void setType(SIMType type) {
        this.type = type;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Double getBalance() {
        return balance;
    }

    public void setBalance(Double balance) {
        this.balance = balance;
    }

    public int getCallTime() {
        return callTime;
    }

    public void setCallTime(int callTime) {
        if(callTime <=0 ) {
            System.out.println("错误的通话时间。");
        }
        this.callTime = callTime;
    }

    public Double getDataRemain() {
        return dataRemain;
    }

    public void setDataRemain(Double dataRemain) {
        this.dataRemain = dataRemain;
    }

    public Invoice getInvoice() {
        return invoice;
    }

    public void setInvoice(Invoice invoice) {
        this.invoice = invoice;
    }
}
